package cn.wolfcode.trip.app.web.controller;

import cn.wolfcode.trip.base.domain.ScenicTicket;
import cn.wolfcode.trip.base.query.TicketObject;
import cn.wolfcode.trip.base.service.ITicketService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 给推荐景点售票,前端只提供高差功能,预售门票
 */
@RestController
@RequestMapping("/scenicTicket")
public class ScenicTicketController {


    @Autowired
    private ITicketService ticketService;

    //获取到单独的一个门票的信息
    @GetMapping("/{id}")
    public ScenicTicket selectOne(@PathVariable Long id) {
        return ticketService.get(id);
    }

    //查询所有景点中符合条件的,高级查询
    @GetMapping("/getScenic")
    public PageInfo<ScenicTicket> getScenic(TicketObject qo) {
        return ticketService.query(qo);
    }


    //查询正在被推荐的景点的门票:
    @GetMapping("/getScenicCommend")
    public PageInfo<ScenicTicket> getScenicGood(TicketObject qo) {
        //只查询推荐状态的景点
        qo.setSelected(3L);
        //思路:在页面点击
        return ticketService.query(qo);
    }


}
